package com.smap.vector;

import com.smap.core.XY;

public class GeomUtils {
	public static boolean isSimple(Polygon polygon) {
		// List<LineSegment> lines = polygon.getLineSegments();
		// Set<RLineSegment2D> segments = new HashSet<RLineSegment2D>();
		// for (LineSegment line : lines) {
		// RPoint2D p1 = new RPoint2D(new Rational((long) line.p1.x),
		// new Rational((long) line.p1.y));
		// RPoint2D p2 = new RPoint2D(new Rational((long) line.p2.x),
		// new Rational((long) line.p2.y));
		// RLineSegment2D line2d = new RLineSegment2D(p1, p2);
		// segments.add(line2d);
		// }
		// boolean simple = !ShamosHoey.intersectionExists(segments, true);
		// return simple;
		return true;
	}

	public static Geometry clone(Geometry geom) {
		Geometry geomCopy = null;
		if (geom instanceof Point) {
			geomCopy = new Point();
		} else if (geom instanceof LineString) {
			geomCopy = new LineString();
		} else if (geom instanceof Polygon) {
			geomCopy = new Polygon();
		}
		for (XY p : geom.coordinates) {
			geomCopy.add(new XY(p));
		}
		// geomCopy.pack();
		return geomCopy;
	}

}
